/*
 * Copyright (C) 2015 huwentao.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.mokey.core.demo;

import android.os.Bundle;
import android.support.v7.widget.Toolbar;

import com.mokey.core.annotation.Layout;
import com.mokey.core.base.BaseActivity;
import com.mokey.core.demo.moudle.Weather;
import com.mokey.core.retrofit.convert.fastjson.FastJsonConverterFactory;

import butterknife.BindView;
import butterknife.OnClick;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;

@Layout(R.layout.activity_retrofit)
public class RetrofitActivity extends BaseActivity {
    @BindView(R2.id.toolbar) Toolbar toolbar;

    @Override
    protected void init(Bundle savedInstanceState) {
        initToolBar(toolbar,true);
    }

    @OnClick(R.id.login)
    public void login(){
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl("http://apis.baidu.com/apistore/")
                .addConverterFactory(FastJsonConverterFactory.create())
                .build();
        API.WeatherAPI weather = retrofit.create(API.WeatherAPI.class);
        weather.citylist("2f7c95edc98dd2f3799fbca06a026c03","长沙").enqueue(new Callback<Weather>() {
            @Override
            public void onResponse(Call<Weather> call, Response<Weather> response) {

            }

            @Override
            public void onFailure(Call<Weather> call, Throwable t) {

            }
        });
    }

    @OnClick(R.id.queryUser)
    public void queryUser(){

    }

}
